// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'element-ui/lib/theme-chalk/index.css'

import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
Vue.use(ElementUI)
// -ie兼容
import "babel-polyfill"

import VueBus from 'vue-bus'
Vue.use(VueBus)

Vue.config.productionTip = false
import Moment from 'moment'
// -挂载消息弹窗,方便后续统一修改
import { Message } from 'element-ui'

import { post, get } from './api/http'
import { apiUrl } from './api/api-url'
import sessionStorage from './util/session-storage'
import localStorage from './util/local-storage'

import utils from './util/utils'

Vue.prototype.$moment = Moment;
Vue.prototype.$message = Message;
Vue.prototype.$post = post;
Vue.prototype.$get = get;
Vue.prototype.$apiUrl = apiUrl;
Vue.prototype.$session = sessionStorage;
Vue.prototype.$local = localStorage;
Vue.prototype.$utils = utils;

import MenuTop from './api/mock-data/menu-top'
Vue.prototype.$menuTop = MenuTop;
/* eslint-disable no-new */

router.beforeEach((to,from,next) => {
  next()
	// let token = sessionStorage.getItem('token')
	// if(token) {
	// 	next()
	// } else if(to.path == '/login'){
	// 	next()
	// } else {
	// 	Message.error("未登录，请先登录");
	// 	next({
	// 		path: '/login'
	// 	})
	// }
})

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
